<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>大事件-首页</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/main.css">
</head>

<body>
    <div class="header">
        <a href="#" class="logo fl"><img src="images/logo.png" alt="logo"></a>
        <div class="search_form fl">
            <input type="text" class="search_txt" placeholder="黑洞照片">
            <button class="search_btn"><i class="fa fa-search"></i></button>
        </div>
        <div class="link_info fr">
            <a href="#"><i class="fa fa-angle-right"></i>&nbsp;&nbsp;网站地图</a><br>
            <a href="#"><i class="fa fa-angle-right"></i>&nbsp;&nbsp;招聘信息</a>
        </div>
    </div>

    <div class="menu_con">
        <div class="menu">
            <div class="menu_collapse fl">
                <a href="javascript:;" class="level_one"><i class="fa fa-list-ul"></i>全部分类</a>
                <ul class="level_two">
                    <li class="up"></li>
                    <li><a href="./list.html">最 新</a></li>
                    <li><a href="./list.html">科 技</a></li>
                    <li><a href="./list.html">股 市</a></li>
                    <li><a href="./list.html">商 品</a></li>
                    <li><a href="./list.html">外 汇</a></li>
                    <li><a href="./list.html">公 司</a></li>
                </ul>
            </div>
            <ul class="left_menu fl">
                <li><a href="#">最 新</a></li>
                <li><a href="#">科 技</a></li>
                <li><a href="#">股 市</a></li>
                <li><a href="#">商 品</a></li>
                <li><a href="#">外 汇</a></li>
                <li><a href="#">公 司</a></li>
            </ul>
            <ul class="right_menu fr">
                <li><a href="#">科技专题</a></li>
                <li><a href="#">财经专题</a></li>
            </ul>
        </div>
    </div>

    <div class="main_con clearfix">
        <div class="left_con">
            <ul class="focus_list">
               
            </ul>

            <div class="common_title">
                <h3><i class="fa fa-edit"></i> 最新资讯</h3>
                <a href="#" class="more"><i class="fa fa-angle-double-right"></i></a>
            </div>

            <div class="common_news">
              
            </div>

        </div>
        <div class="right_con">
            <div class="common_wrap">
                <h3><i class="fa fa-bar-chart"></i> 一周热门排行</h3>
                <ul class="content_list hotrank_list">
                
                </ul>
            </div>
            <div class="common_wrap">
                <h3><i class="fa fa-commenting-o"></i> 最新评论</h3>
                <ul class="content_list comment_list">
                    
                   
                </ul>
            </div>
            <div class="common_wrap">
                <h3><i class="fa fa-bullseye"></i> 焦点关注</h3>
                <ul class="content_list guanzhu_list">
               
                </ul>
            </div>
        </div>
    </div>

    <div class="footer clearfix">
        <div class="foot_link">
            <a href="#">关于我们</a>
            <span>|</span>
            <a href="#">联系我们</a>
            <span>|</span>
            <a href="#">招聘人才</a>
            <span>|</span>
            <a href="#">友情链接</a>
        </div>
        <p>CopyRight © 2019 深圳大事件信息技术股份有限公司 All Rights Reserved</p>
        <p>电话：0755-****888 粤ICP备*******8号</p>
    </div>

<!-- 导入模板引擎js文件 -->
    <script src="./js/template-web.js"></script>
    <!-- 引入jq文件 -->
    <script src="./js/jquery-1.12.4.min.js"></script>
</body>
<!-- 热点图模板引擎 -->
<script type="text/html" id="srcId">
{{each data}}
{{if $index == 0}}
<li class="first">
{{else}}
<li>
{{/if}}
        <a href="./article.html?id={{$value.id}}"><img src="{{$value.cover}}" alt=""></a>
        <p>{{@ $value.title}}</p>
    </li>
{{/each}}
</script>
<!-- 最新资讯模板 -->
<script type="text/html" id="newsId">
{{each data}}
<div class="common_news_list">
    <a href="./article.html?id={{$value.id}}" class="list_pic"><img src="{{$value.cover}}" alt=""></a>
    <h4><a href="./article.html?id={{$value.id}}">{{$value.title}} </a></h4>
    <p>{{@ $value.intro}} </p>
    <div class="new_info">
        <span>标签：{{$value.category}}&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<i class="fa fa-eye"></i>&nbsp;阅读( {{$value.read}}
            )&nbsp;&nbsp;&nbsp;<i class="fa fa-commenting"></i>&nbsp;评论({{$value.comments}})</span>
        <b>发布于 {{$value.date}}</b>
    </div>
</div>
{{/each}}
</script>

<!-- 最新评论模板 -->
<script type="text/html" id="commitId">
{{each data}}
<li>
    <span>{{$value.author}}</span>
    <b><em>{{$value.author}}</em> {{$value.date}} {{$value.time}}说:</b>
    <strong>{{$value.intro}}</strong>
</li>
{{/each}}
</script>

<!-- 文章热门排行 -->
<script type="text/html"  id="hotId">
{{each data}}
{{if $index == 0}}
<li><span class="first">{{$index + 1}}</span><a href="./article.html?id={{$value.id}}">{{$value.title}}</a></li>
{{else if $index == 1}}
<li><span class="second">{{$index + 1}}</span><a href="./article.html?id={{$value.id}}">{{$value.title}}</a></li>
{{else if $index == 2}}
<li><span class="third">{{$index + 1}}</span><a href="./article.html?id={{$value.id}}">{{$value.title}}</a></li>
{{else}}
<li><span>{{$index + 1}}</span><a href="./article.html?id={{$value.id}}">{{$value.title}}</a></li>
{{/if}}
{{/each}}
</script>


<!-- 焦点关注模版 -->
<script type="text/html" id="sunId">
{{each data}}
<li><a href="javascript:void(0);">{{$value.intro}}</a></li>
{{/each}}
</script>

 <script>
$(function(){
    // 动态热点图
 $.get({
     url : 'http://localhost:8080/api/v1/index/hotpic',
     success : function(res){
         let htmlStr = template('srcId',res);
   $('.focus_list').html(htmlStr);
     }
 })

// 最新资讯动态生成
$.get({
    url : 'http://localhost:8080/api/v1/index/latest',
    success : function(res){
       if(res.code==200){
        let htmlStr = template('newsId',res);
        $('.common_news').html(htmlStr);
       }
    }
})

// 最新评论动态生成
$.get({
    url : 'http://localhost:8080/api/v1/index/latest_comment',
    success : function(res){
        if(res.code == 200){
  let  htmlStr = template('commitId',res);
  $('.comment_list').html(htmlStr);
        }
    }
});


// 文章热门排行
$.get({
    url :' http://localhost:8080/api/v1/index/rank',
    success : function(res){
       
      if(res.code == 200){
          let htmlStr = template('hotId',res);
           $('.hotrank_list').html(htmlStr);
      }
    }
});

// 焦点关注
$.get({
    url : 'http://localhost:8080/api/v1/index/attention',
    success : function(res){
    if(res.code == 200){
        let htmlStr = template('sunId',res);
        $('.guanzhu_list').html(htmlStr);
    }
    }
})

})


</script> 
</html> 